package fr.umlv.rtsjtaskserver.server;

import java.util.ArrayList;
import java.util.List;


public class ServableAsyncEventHandler{
	
	private final TaskServer server;
	
	private List<ServableAsyncEvent> events = new ArrayList<ServableAsyncEvent>();
	
	
	public ServableAsyncEventHandler(TaskServer server) {
		this.server = server;
	}
	
	public void handleServableAsyncEvent(ServableAsyncEvent event){
		this.events.add(event);
		
		//notify the server that an event is released
		this.server.eventReleased(this);
	}
	
	public ServableAsyncEvent getServableAsyncEvent(){
		return this.events.remove(this.events.size());
	}
}
